{extend name='public/form'/}
<!-- 表单字段 -->
{block name='fields'}
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this">基本设置</li>
        <li>高级设置</li>
        <li>其它设置</li>
    </ul>
    <div class="layui-form layui-tab-content">
        {:token_field()}
        <div class="layui-tab-item layui-show">{$fields['basics']|build_form=$default|raw}</div>
        <div class="layui-tab-item">{$fields['advanced']|build_form=$default|raw}</div>
        <div class="layui-tab-item">{$fields['other']|build_form=$default|raw}</div>
    </div>
</div>
{/block}
<!-- 表单提交 -->
{block name='submit'}
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="button" class="layui-btn" lay-submit="" lay-filter="basesetting">保存</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</div>
{/block}
<!-- js -->
{block name='js'}
<script>
    layui.use(['form'], function () {
        var form = layui.form
            , $ = layui.jquery;

        // 监听提交
        form.on('submit(basesetting)', function (data) {
            $.post('/admins/setting/basesetting', data.field, function (res) {
                if (res.code) return layer.alert(res.msg, { icon: 2 });
                layer.alert(res.msg, { icon: 1 });
                setTimeout(function () {
                    window.location.reload()
                }, 1000);
            }, 'json');
            return false;
        });
    });
</script>
{/block}